package com.sgcc.lms.condition;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @Author: 李孟帅
 * @CreateTime: 2020-11-27 15:15
 * @Description:
 */
public class WindowsCondition implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        ClassLoader classLoader = conditionContext.getClassLoader();
        BeanDefinitionRegistry registry = conditionContext.getRegistry();
        Environment environment = conditionContext.getEnvironment();
        String property = environment.getProperty("os.name");
        if (property.contains("Windows 10")) {
//            System.out.println(property);
            return true;

        }
        return false;
    }
}
